import { z } from 'zod'

const hexColorSchema = z.string().regex(/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/, {
    message: 'Invalid color format. Use #RGB or #RRGGBB.',
})

const colorGradientSchema = z.object({
    _100: hexColorSchema,
    _200: hexColorSchema,
    _300: hexColorSchema,
    _400: hexColorSchema,
    _500: hexColorSchema,
    _600: hexColorSchema,
    _700: hexColorSchema,
    _800: hexColorSchema,
    _900: hexColorSchema,
})

export const themeColorSchemaV1 = z.object({
    version: z.number().int(),
    name: z.string(),
    quote: hexColorSchema,
    shadow: hexColorSchema,
    primary: colorGradientSchema,
    neutral: colorGradientSchema,
    error: colorGradientSchema,
    text: colorGradientSchema,
})

export type ThemeColor = z.infer<typeof themeColorSchemaV1>

export namespace DefaultColorSchemes {
    export const lavenderDark: ThemeColor = {
        version: 1,
        name: 'Lavender Dark',
        primary: {
            _100: '#2a254d',
            _200: '#3d3563',
            _300: '#554a7c',
            _400: '#695b91',
            _500: '#7d6fa6',
            _600: '#927fb9',
            _700: '#a794cc',
            _800: '#b9a7db',
            _900: '#eeddff',
        },
        neutral: {
            _100: '#121018',
            _200: '#26222E',
            _300: '#343040',
            _400: '#423E52',
            _500: '#5C5870',
            _600: '#76728E',
            _700: '#908CAC',
            _800: '#AAA6CA',
            _900: '#C4C0E8',
        },
        error: {
            _100: '#ff8080',
            _200: '#ee6666',
            _300: '#d34d4d',
            _400: '#b83333',
            _500: '#9c1a1a',
            _600: '#800000',
            _700: '#640000',
            _800: '#480000',
            _900: '#2c0000',
        },
        text: {
            _100: '#f4f4f4',
            _200: '#e6e6e6',
            _300: '#c8c8c8',
            _400: '#aaaaaa',
            _500: '#8c8c8c',
            _600: '#6e6e6e',
            _700: '#505050',
            _800: '#323232',
            _900: '#000000',
        },
        quote: '#e69d17',
        shadow: '#111111',
    }

    export const lavenderLight: ThemeColor = {
        version: 1,
        name: 'Lavender Light',
        primary: {
            _100: '#e8e6ff',
            _200: '#cfcaff',
            _300: '#b6adff',
            _400: '#9e91ff',
            _500: '#8675ff',
            _600: '#6e5ae6',
            _700: '#5645cc',
            _800: '#3e2fb3',
            _900: '#271a99',
        },
        neutral: {
            _100: '#F5F2FA',
            _200: '#EDEAF4',
            _300: '#D8D4E6',
            _400: '#C4BED8',
            _500: '#B0A8CA',
            _600: '#9C92BB',
            _700: '#7D759A',
            _800: '#5E5878',
            _900: '#3F3B55',
        },
        error: {
            _100: '#f2d6d6',
            _200: '#e6a3a3',
            _300: '#d98080',
            _400: '#cc5c5c',
            _500: '#bf3939',
            _600: '#a62e2e',
            _700: '#8c2525',
            _800: '#731c1c',
            _900: '#5c1414',
        },
        text: {
            _100: '#201a2b',
            _200: '#413b4d',
            _300: '#625e70',
            _400: '#837f94',
            _500: '#a5a1b8',
            _600: '#c7c3dc',
            _700: '#e2dff0',
            _800: '#f0ecf9',
            _900: '#faf7ff',
        },
        quote: '#e69d17',
        shadow: '#aaa',
    }

    export const amoled: ThemeColor = {
        version: 1,
        name: 'AMOLED Black & White',
        primary: {
            _100: '#333333',
            _200: '#4d4d4d',
            _300: '#666666',
            _400: '#808080',
            _500: '#999999',
            _600: '#b3b3b3',
            _700: '#cccccc',
            _800: '#e6e6e6',
            _900: '#ffffff',
        },
        neutral: {
            _100: '#000000',
            _200: '#0a0a0a',
            _300: '#141414',
            _400: '#1e1e1e',
            _500: '#282828',
            _600: '#323232',
            _700: '#3c3c3c',
            _800: '#464646',
            _900: '#505050',
        },
        error: {
            _100: '#ffffff',
            _200: '#e6e6e6',
            _300: '#cccccc',
            _400: '#b3b3b3',
            _500: '#999999',
            _600: '#808080',
            _700: '#666666',
            _800: '#4d4d4d',
            _900: '#333333',
        },
        text: {
            _100: '#ffffff',
            _200: '#e6e6e6',
            _300: '#cccccc',
            _400: '#b3b3b3',
            _500: '#999999',
            _600: '#808080',
            _700: '#666666',
            _800: '#4d4d4d',
            _900: '#333333',
        },
        quote: '#e6a317',
        shadow: '#ffffff',
    }

    export const navyDark: ThemeColor = {
        version: 1,
        name: 'Navy Dark',
        primary: {
            _100: '#101a2d',
            _200: '#162444',
            _300: '#1c305b',
            _400: '#223c72',
            _500: '#274889',
            _600: '#2d549f',
            _700: '#3260b6',
            _800: '#3974cc',
            _900: '#4188e3',
        },
        neutral: {
            _100: '#0e1218',
            _200: '#1b1f2e',
            _300: '#272c40',
            _400: '#343a52',
            _500: '#505870',
            _600: '#6c7590',
            _700: '#8892b0',
            _800: '#a4aecf',
            _900: '#c0cbea',
        },
        error: {
            _100: '#ff8080',
            _200: '#ee6666',
            _300: '#d34d4d',
            _400: '#b83333',
            _500: '#9c1a1a',
            _600: '#800000',
            _700: '#640000',
            _800: '#480000',
            _900: '#2c0000',
        },
        text: {
            _100: '#e4e8f4',
            _200: '#c8d1e6',
            _300: '#aab9d8',
            _400: '#8ca1ca',
            _500: '#6e89bc',
            _600: '#506f9e',
            _700: '#325681',
            _800: '#1a3c63',
            _900: '#001f46',
        },
        quote: '#e6a317',
        shadow: '#000000',
    }

    export const hotPink: ThemeColor = {
        version: 1,
        name: 'Pink',
        primary: {
            _100: '#ffb3c9',
            _200: '#ff99b3',
            _300: '#ff809d',
            _400: '#e6738f',
            _500: '#cc6682',
            _600: '#b35974',
            _700: '#994d66',
            _800: '#804059',
            _900: '#66334b',
        },
        neutral: {
            _100: '#ffe6eb',
            _200: '#ffccd6',
            _300: '#ffb3c2',
            _400: '#ff99ad',
            _500: '#ff8099',
            _600: '#e67386',
            _700: '#cc6673',
            _800: '#b35961',
            _900: '#994c4f',
        },
        error: {
            _100: '#ff8080',
            _200: '#ee6666',
            _300: '#d34d4d',
            _400: '#b83333',
            _500: '#9c1a1a',
            _600: '#800000',
            _700: '#640000',
            _800: '#480000',
            _900: '#2c0000',
        },
        text: {
            _100: '#994d66',
            _200: '#804059',
            _300: '#66334b',
            _400: '#592d42',
            _500: '#4d2639',
            _600: '#401f30',
            _700: '#331828',
            _800: '#290f20',
            _900: '#1f0a18',
        },
        quote: '#e6a317',
        shadow: '#000000',
    }

    export const retroGreen: ThemeColor = {
        version: 1,
        name: 'Retro Green',
        primary: {
            _100: '#38582a',
            _200: '#486839',
            _300: '#587848',
            _400: '#688857',
            _500: '#789866',
            _600: '#88a875',
            _700: '#98b884',
            _800: '#a8c893',
            _900: '#b8d8a2',
        },
        neutral: {
            _100: '#101010',
            _200: '#181818',
            _300: '#202020',
            _400: '#282828',
            _500: '#303030',
            _600: '#383838',
            _700: '#404040',
            _800: '#484848',
            _900: '#505050',
        },
        error: {
            _100: '#ff8080',
            _200: '#ee6666',
            _300: '#d34d4d',
            _400: '#b83333',
            _500: '#9c1a1a',
            _600: '#800000',
            _700: '#640000',
            _800: '#480000',
            _900: '#2c0000',
        },
        text: {
            _100: '#c4d4b2',
            _200: '#b4c4a2',
            _300: '#a4b492',
            _400: '#94a482',
            _500: '#849472',
            _600: '#748462',
            _700: '#647452',
            _800: '#546442',
            _900: '#445432',
        },
        quote: '#e6a317',
        shadow: '#000000',
    }

    export const schemes = [lavenderDark, lavenderLight, amoled, navyDark, hotPink, retroGreen]
}
